package cn.myblog.ainblog.conroller;


import cn.myblog.ainblog.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

/**
 * @author Dovaior
 * @Description 前端index页面的控制器
 * @create 2021-03-16 09:33
 **/
@Controller
public class IndexPageController {
    @Autowired
    private ArticleService articleService;

    @GetMapping("/index")
    public String index(Model model){
        //喜欢数量最高的3个
        model.addAttribute("likeCountLimit3",articleService.queryArticleAndContentLimit3());
        //最新发布的3个
        model.addAttribute("newCreateLimit3",articleService.queryArticleAndContentLimit3orderdate());
        //查询全部的博文显示前端
        model.addAttribute("allArticleVOList", articleService.queryAllArticleToIndex());
        return "index";
    }
}
